From a7c18c4ae8f5c1685b4c02042c0ac51b9ecf7eea Mon Sep 17 00:00:00 2001 From: "cl349@firebug.cl.cam.ac.uk" Date: Wed, 24 Aug 2005 09:31:52 +0000 Subject: [PATCH] Don't use the grant pre-allocation system for the ring grants. Signed-off-by: Christian Limpach --- .../drivers/xen/netfront/netfront.c | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c index 0e02227c16..cccfaa98ee 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c @@ -200,6 +200,7 @@ static char *be_state_name[] = { [BEST_CONNECTED] = "connected", }; +#define DEBUG #ifdef DEBUG #define DPRINTK(fmt, args...) \ printk(KERN_ALERT "xen_net (%s:%d) " fmt, __FUNCTION__, __LINE__, ##args) @@ -919,6 +920,7 @@ static void vif_show(struct net_private *np) /* Send a connect message to xend to tell it to bring up the interface. */ static void send_interface_connect(struct net_private *np) { + int err; ctrl_msg_t cmsg = { .type = CMSG_NETIF_FE, .subtype = CMSG_NETIF_FE_INTERFACE_CONNECT, @@ -929,24 +931,22 @@ static void send_interface_connect(struct net_private *np) msg->handle = np->handle; msg->tx_shmem_frame = virt_to_mfn(np->tx); #ifdef CONFIG_XEN_NETDEV_GRANT_TX - msg->tx_shmem_ref = (u32)gnttab_claim_grant_reference(&gref_tx_head); - if(msg->tx_shmem_ref < 0) { - printk(KERN_ALERT "#### netfront can't claim tx_shmem reference\n"); + err = gnttab_grant_foreign_access(rdomid, msg->tx_shmem_frame, 0); + if (err < 0) { + printk(KERN_ALERT "#### netfront can't grant access to tx_shmem\n"); BUG(); } - gnttab_grant_foreign_access_ref (msg->tx_shmem_ref, rdomid, - msg->tx_shmem_frame, 0); + msg->tx_shmem_ref = err; #endif msg->rx_shmem_frame = virt_to_mfn(np->rx); #ifdef CONFIG_XEN_NETDEV_GRANT_RX - msg->rx_shmem_ref = (u32)gnttab_claim_grant_reference(&gref_rx_head); - if(msg->rx_shmem_ref < 0) { - printk(KERN_ALERT "#### netfront can't claim rx_shmem reference\n"); + err = gnttab_grant_foreign_access(rdomid, msg->rx_shmem_frame, 0); + if (err < 0) { + printk(KERN_ALERT "#### netfront can't grant access to rx_shmem\n"); BUG(); } - gnttab_grant_foreign_access_ref (msg->rx_shmem_ref, rdomid, - msg->rx_shmem_frame, 0); + msg->rx_shmem_ref = err; #endif ctrl_if_send_message_block(&cmsg, NULL, 0, TASK_UNINTERRUPTIBLE); @@ -1416,8 +1416,8 @@ static int __init netif_init(void) if (xen_start_info.flags & SIF_INITDOMAIN) return 0; #ifdef CONFIG_XEN_NETDEV_GRANT_TX - /* A grant for every ring slot, plus one for the ring itself */ - if (gnttab_alloc_grant_references(NETIF_TX_RING_SIZE + 1, + /* A grant for every ring slot */ + if (gnttab_alloc_grant_references(NETIF_TX_RING_SIZE, &gref_tx_head) < 0) { printk(KERN_ALERT "#### netfront can't alloc tx grant refs\n"); return 1; @@ -1425,8 +1425,8 @@ static int __init netif_init(void) printk(KERN_ALERT "Netdev frontend (TX) is using grant tables.\n"); #endif #ifdef CONFIG_XEN_NETDEV_GRANT_RX - /* A grant for every ring slot, plus one for the ring itself */ - if (gnttab_alloc_grant_references(NETIF_RX_RING_SIZE + 1, + /* A grant for every ring slot */ + if (gnttab_alloc_grant_references(NETIF_RX_RING_SIZE, &gref_rx_head) < 0) { printk(KERN_ALERT "#### netfront can't alloc rx grant refs\n"); return 1; -- 2.30.2